<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <link rel="stylesheet" href="/js/prism.css">
    <link rel="stylesheet" href="/css/app.css">
    <title>mac制作ubuntu系统安装U盘 - 叫兽</title>
    <link rel="icon" type="image/x-icon" class="js-site-favicon" href="/img/favicon.ico">
  </head>
  <body>

        <div class="container bg-white pb-5 px-5 spx-0">
            
            <h1 class="post-title">mac制作ubuntu系统安装U盘</h1>




            <h2>下载ubuntu操作系统</h2><p> desktop 或者 server版的都可以，这里我用的是ubuntu-16.04.4-server-amd64.iso  </p><h2>把文件转换为mac下的dmg文件</h2><p><code>hdiutil convert -format UDRW -o ubuntu ubuntu-16.04.4-server-amd64.iso</code></p><pre><code class=".language-bash">Reading Driver Descriptor Map &#40;DDM : 0&#41;…
Reading Ubuntu-Server 16.04.4 LTS amd64  &#40;Apple&#95;ISO : 1&#41;…
Reading Apple &#40;Apple&#95;partition&#95;map : 2&#41;…
Reading Ubuntu-Server 16.04.4 LTS amd64  &#40;Apple&#95;ISO : 3&#41;…
..........................................
Reading EFI &#40;Apple&#95;HFS : 4&#41;…
..........................................
Reading Ubuntu-Server 16.04.4 LTS amd64  &#40;Apple&#95;ISO : 5&#41;…
..........................................................................................................................................................................
Elapsed Time:  3.047s
Speed: 278.2Mbytes/sec
Savings: 0.0%
created: /Users/edison/Downloads/ubuntu.dmg
</code></pre><p>生成<code>ubuntu.dmg</code>文件</p><p>-format为生成文件的权限,UDRW表示转换成有read/write的权限的镜像。</p><h2>查看U盘信息</h2><p><code>diskutil list</code></p><pre><code class=".language-bash">/dev/disk0 &#40;internal&#41;:
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID&#95;partition&#95;scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple&#95;APFS Container disk1         500.0 GB   disk0s2

/dev/disk1 &#40;synthesized&#41;:
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            417.0 GB   disk1s1
   2:                APFS Volume Preboot                 22.2 MB    disk1s2
   3:                APFS Volume Recovery                517.8 MB   disk1s3
   4:                APFS Volume VM                      6.4 GB     disk1s4

/dev/disk2 &#40;external, physical&#41;:
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID&#95;partition&#95;scheme                        &#42;8.0 GB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:       Microsoft Basic Data UNTITLED                7.8 GB     disk2s2
</code></pre><h2>卸载U盘</h2><p>/dev/disk2 就是 U 盘，需要先unmount掉 U 盘，注意不是弹出。然后把安装文件写入 U 盘</p><p><code>diskutil unmountDisk /dev/disk2</code></p><p>unmount后，电脑上就看不到这个 U 盘了</p><h2>把安装文件写入 U 盘</h2><p>先把ubuntu.dmg改为ubuntu.iso，方便安装的时候识别。</p><p><code>mv ubuntu.dmg ubuntu.iso</code></p><p>把安装文件写入到U盘中</p><p><code>sudo dd if=./ubuntu.iso of=/dev/rdisk2 bs=1m</code></p><p>这行命令必须使用root权限，</p><ul><li>if : 输入文件名</li><li>of : 输出的文件名地址</li><li>bs : 是块大小,氛围1m 的块大小</li><li>慢慢等写完会有提示...</li></ul><h2>弹出 U盘，然后安全拔出</h2><p>结束后，终端会显示</p><pre><code class=".language-bash">848+0 records in
848+0 records out
889192448 bytes transferred in 203.405350 secs &#40;4371529 bytes/sec&#41;
</code></pre><p>同时系统会弹出eject U 盘的对话框，点击eject，然后就可以安全拔出 U 盘。</p><p>如果没有弹出，就在终端执行eject命令</p><p><code>sudo eject /dev/rdisk2</code></p><h2>把安装 U盘，恢复为普通U 盘</h2><p>插入系统安装 U 盘的时候，可能系统里面会弹出一个对话框</p><p><img src="/static/2018/4/img/eject.png" alt="" /></p><p>不用管它，直接在终端执行：</p><p><code>sudo dd if=/dev/urandom of=/dev/rdisk2</code></p><p>使用随机数据来填充 U 盘，然后就可以随意在苹果磁盘工具里面格式化为自己想要的任何格式了。</p>
            <p class="text-left text-muted">2018-12-02 16:53</p>
        </div>
        <div class="container">
            <div class="row mt-4">
                <div class="col-6 text-left"><a href="/p/2018/4/13/IntelliJ-IDEA-with-clojure/">上一篇: 学习使用IntelliJ IDEA开发clojure</a></div>
                <div class="col-6 text-right"><a href="/p/2018/4/8/tv-box-development/">下一篇:电视机顶盒上网页应用开发的思路</a></div>
            </div>
        </div>

        <button class="btn btn-link m-menu-toggle d-md-none fixed-top collapsed" type="button" data-toggle="collapse" data-target="#m-menu" aria-controls="m-menu" aria-expanded="false" aria-label="Toggle docs navigation"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30" height="30" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-miterlimit="10" d="M4 7h22M4 15h22M4 23h22"></path></svg>
        </button>
        <ul class="nav flex-column collapse fixed-top site-menu d-md-block" id="m-menu">
            <li class="nav-item">
                <a class="nav-link" href="/">首页</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/p/list/">所有文章</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/p/about-me/">关于我</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="https://github.com/arlicle">Github</a>
          </li>
        </ul>

        
    <div class="container mt-5">
        <h3>留言</h3>
        <div id="commentApp"></div>
    </div>
    <script>
        var AL_configs = {
            "post_id":"/p/2018/4/9/mac-ubuntu-systerm/",
            "appid":"847e226e8a46f64045d45312245a68ba1368a564"
        };
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://comment.debugmyself.com/sc.js";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>


        <footer class="footer mt-5 pb-2">
        <div class="container text-center">
          
          <p><span class="text-black-50">Powered by <a href="https://github.com/arlicle/ablog">ablog</a> © 2019 叫兽</span></p>
          <p><span class="text-black-50"><a href="http://www.beian.miit.gov.cn/">滇ICP备10201832号-3</a></span></p>
          
        </div>
        </footer>
        <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
        <script src="/js/prism.js"></script>
        <script>
        $(function () {
            $('[data-toggle="tooltip"]').tooltip();
        })
        </script>
        <script type="text/x-mathjax-config">
        MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, displayAlign: "left",scale: 180});
        </script>
        <script type="text/javascript" async
        src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_SVG" async>
        </script>
  </body>
</html>